<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <h3>面向对象特性</h3>
    <ul>
      <li>封装性</li>
      <li>继承性</li>
      <li>多态性</li>
      <!-- <p>特性：，，</p> -->
    </ul>
    <script>
      class Person {
        constructor(uname, age, sex) {
          this.uname = uname;
          this.age = age;
          this.sex = sex;
        }
        work() {
          console.log("wo zai gongzuo");
        }
        eat(something, a) {
          console.log("wo zai chi " + something);
          console.log(arguments, typeof arguments);
          //如果一个参数 就走 饭前吃的逻辑
          if (arguments.length === 1) {
            // ;asda;lkd
          } else if (arguments.length === 2) {
            //如果2个参数 饭后吃的逻辑
          }
        }
      }

      class Students extends Person {
        constructor(uname, age, sex) {
          super(uname, age, sex);
        }
        learn() {
          console.log("wo zai xuexi");
        }
      }

      var yizhi = new Students("yizhi", 19, "nan");
      console.log(yizhi);
      yizhi.work();
      yizhi.eat("fan");
      yizhi.eat("fan", "233");
      //-1. 函数名相同、函数的的形参个数不同
      //0. 因为在js同一作用域下，同名的函数，最终只会按最后一个函数来实现操作
      //1. js不能真正意义上实现 重载
    </script>
  </body>
</html>
